﻿<?php
	
	include 'funcoes.php';
	include '../conexao.php';
	
	if($_POST['tabela']){
		$tabela  = $_POST['tabela'];
		$id_prof = $_POST['id_prof'];
		$tabela2 = "avaliacao_geral";
		
		$data = DBRead('{$tabela}',"WHERE id_prof = '{$id_prof}'");
		
			for($i = 0;$i < 26 ;$i++){
				echo "<tr>";
				for($j = 1;$j <= 45; $j++){
					echo "<td></td>";
				}
				echo "</tr>";
				
		echo "<table id='demo-table'>";
		echo "<thead";
		echo ("<tr>
				<td>Nome</td>
				<td>Q1</td>
				<td>Q2</td>
				<td>Q3</td>
				<td>Q4</td>
				<td>Q5</td>
				<td>Q6</td>
				<td>Q7</td>
				<td>Q8</td>	
				<td>Q9</td>
				<td>10</td>
				<td>Q11</td>
				<td>Q12</td>
				<td>Q13</td>
				<td>Q14</td>
				<td>Q15</td>
				<td>Q16</td>
				<td>Q17</td>
				<td>Q18</td>
				<td>Q19</td>
				<td>Q20</td>
				<td>Q21</td>
				<td>Q22</td>
				<td>Q23</td>
				<td>Q24</td>
				<td>Q25</td>
			</tr>");
		echo "</thead>";
			for($i = 1;$i <= 45 ;$i++){
				echo "<tr style='border:1px solid #333;'>";
				$data  = DBRead($tabela, "WHERE id = {$i}");
				$dados = DBRead($tabela2, "WHERE id_prof = ".$id_prof." && id_aluno = ".$i);
				
				if($data['nome'] != null){
					echo "<td style='font-size:12px;color:#093;border:1px solid #333;'>{$data['nome']}</td>";
					for($j = 1 ;$j <= 25 ;$j++){
						$mos = $dados['q'.$j.''];
						if($mos == null){
							$mos = 'Falta avaliar';
						}else if($mos == 5){
							$mos = 'Sempre';
						}else if($mos == 4){
							$mos = 'As Vezes';
						}else if($mos == 3){
							$mos = 'Raramente';
						}else if($mos == 2){
							$mos = 'Nunca';
						}
						echo "<td style='border:1px solid #333;'>{$mos}</td>";
					}
				}
				echo "</tr>";

			}
		
		echo "</table>";
		}
	}
	
?>